﻿@{
    List<Pro_Building> info = ViewBag.lstNews != null ? (List<Pro_Building>)ViewBag.lstNews : new List<Pro_Building>();

    //var imgMainurl = "../../Content/Image/slide/slide-1.jpg";
    //if (!string.IsNullOrEmpty(info[0].ImageFile))
    //{
    //    imgMainurl = "../Uploads/" + info[0].ImageFile;
    //}       
}
@*<div>
    <div class="divMainImage">
        <div class="newMainImage">
            <img alt="kimthanhhouse" src="@imgMainurl" />
        </div>
        <div>
            <h1 class="mainNewTitle">@info[0].BuildingName</h1>
            <div class="newMainDesc">
                @Html.Raw(info[0].Description)
            </div>
        </div>
    </div>
    <div>
        @{
            bool rowfist = true;
            foreach (Pro_Building itemData in info)
            {
                if (rowfist)
                {
                    rowfist = false;
                    continue;
                }

                var imgurl = "../../Content/Image/admin/image_New.png";
                if (!string.IsNullOrEmpty(itemData.ImageFile))
                {
                    imgurl = "../Uploads/" + itemData.ImageFile;
                }
            
            <div class="div_row Clearfix">
                <div class="divTitleHome">@itemData.BuildingName</div>
                <div class="divdesc">
                    <div class="divdescHome">
                        <p>
                            <img alt="kimthanhhouse" src="@imgurl" class="imageNewHome" />
                            @Html.Raw(itemData.Description)
                        </p>
                    </div>
                </div>
            </div>
            }
        }
    </div>
</div>*@

<div class="tinnbcm ">
    <div id="items-tinnbcm" style=" width: 345px; height:325px;">
    @{
        foreach (Pro_Building itemData in info)
        {
            var imgurl = "../../Content/Image/admin/image_New.png";
            if (!string.IsNullOrEmpty(itemData.ImageFile))
            {
                imgurl = "../Uploads/" + itemData.ImageFile;
            }
            
            <div class="item-tinnb ">
                <a class="link-tinnb" href="/tin-tuc/@itemData.Code">
                    <img class="img_mainNews" alt="@itemData.BuildingName" src="@imgurl" />
                    
                </a>
                <div class="item_info">
                    <h1>
                        <a class="mainNewsTitle" href="/tin-tuc/@itemData.Code">@itemData.BuildingName</a>
                    </h1>
                    <p>@Html.Raw(itemData.Description)</p>
                </div>
            </div>

        }
}
               
    </div>

    <ul id="list_items">

@{
          foreach (Pro_Building itemData in info)
        {
            var imgurl_small = "../../Content/Image/admin/image_New.png";
            if (!string.IsNullOrEmpty(itemData.ImageFile))
            {
                imgurl_small = "../Uploads/" + itemData.ImageFile;
            }
            int _titleLenght = itemData.BuildingName.Length;
            string newsTitle = itemData.BuildingName;
            if(_titleLenght > 45){
                newsTitle = newsTitle.Substring(0, 45) + "...";
            }
              
            <li class="itLi-tinnbcm Clearfix">
                <div class="div_image">
                    <a title="" href="/tin-tuc/@itemData.Code">
                        <img class="img_sub" alt=" @newsTitle " src="@imgurl_small" />
                    </a>
                </div>
                <div class="divTitle">
                    <a href="/tin-tuc/@itemData.Code"> @newsTitle </a>
                </div>
            </li>
            
        }
}
        </ul>

</div>


